<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

// Route::get('/', function () {
//     return view('welcome');
// });

Route::get('/login','Home\LoginController@login');			//登录页面显示
Route::post('/doLogin','Home\LoginController@doLogin');		//登录信息验证


// 注册路由
Route::get('phoneRegister','Home\RegisterController@phoneReg');
Route::get('sendcode','Home\RegisterController@sendCode');
Route::post('doPhoneRegister','Home\RegisterController@doPhoneRegister');
Route::get('emailRegister','Home\RegisterController@register');
Route::post('doEmailRegister','Home\RegisterController@doEmailRegister');
Route::get('active','Home\RegisterController@active');
Route::get('forget','Home\RegisterController@forget');
Route::post('doForget','Home\RegisterController@doForget');
Route::get('reset','Home\RegisterController@reset');
Route::post('doReset','Home\RegisterController@doReset');


// 前台路由
Route::get('/','Home\IndexController@index');
Route::get('lists/{id}','Home\IndexController@lists');
Route::get('detail/{id}','Home\IndexController@detail');
Route::post('collect','Home\IndexController@collect');


// 后台登录
Route::get('/admin/login','Admin\LoginController@login');			//登录页面显示
Route::post('/admin/doLogin','Admin\LoginController@doLogin');		//登录信息验证
// Route::get('/admin/code','Admin\LoginController@code');			//验证码路由
Route::get('/code/captcha/{tmp}', 'Admin\LoginController@captcha');	//验证码路由
Route::get('/admin/logout','Admin\LoginController@logout');			//退出后台登录
Route::get('noaccess','Admin\LoginController@noaccess');			//无权访问提示

// 后台路由
Route::group(['prefix'=>'admin','namespace'=>'Admin','middleware'=>['HasRole','IsLogin']],function(){
	Route::get('index','LoginController@index');					//后台主页显示
	Route::get('welcome','LoginController@welcome');				//后台欢迎页面

	Route::get('user/del','UserController@delAll');					//批量删除用户
	Route::get('user/auth/{id}','UserController@auth');				//角色授权页面
	Route::post('user/doAuth','UserController@doAuth');				//角色授权变更
	Route::resource('user','UserController');						//后台用户模块

	Route::get('role/auth/{id}','RoleController@auth');				//角色授权页面
	Route::post('role/doAuth','RoleController@doAuth');				//角色授权变更
	Route::resource('role','RoleController');						//后台角色模块

	Route::get('permission/del','PermissionController@delAll');		//批量删除权限
	Route::resource('permission','PermissionController');			//后台权限模块

	Route::post('cate/changeOrder','CateController@changeOrder');	//分类排序页面
	Route::resource('cate','CateController');						//后台分类模块

	Route::post('article/upload','ArticleController@upload');		//文章图片上传
	Route::resource('article','ArticleController');					//后台文章模块

	Route::post('config/changeContent','ConfigController@changeContent');//批量修改配置
	Route::get('config/putcontent','ConfigController@putContent');	//写入配置文件	
	Route::resource('config','ConfigController');					//网站配置模块
});